<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>v-on</title>
		<!-- 导入vue.js -->
		<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
	</head>
	<body>
		<div id="app">
			<button v-on:click="sayHi"> click me</button>

		</div>
		
		<script>
			var vm =new Vue({
				el:"#app",
				data:{
					message: '我要吃饭了'
				},
				methods: {//方法必须定义在vue的methods中 v-on 绑定事件  列如： v-on:click="sayHi"
				sayHi: function(){
					alert(this.message)
				}
					
				}
			})
		</script>
	</body>
</html>
